<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <cpn v-bind:cmovies="movies" v-bind:cmessage="message"></cpn>
</div>

<template id="cpn">
    <div>
        <ul>
            <li v-for="item in cmovies">{{item}}</li>
        </ul>
        <h2>{{cmessage}}</h2>
    </div>
</template>

<script src="../js/vue.js"></script>
<script>
    // 父传子：prpps
    const cpn = {
        template: `#cpn`,
        //  props: [`cmovies`,`cmessage`],
        props: {
            //类型限制
            cmovies: Array,
            cmessage: String,

            //提供默认值
            cmessage: {
                type: String,
                default: 'aaa',
                //必须传值
                required: true
            },
            cmovies: {
                type: Array,
                default() {
                    return ['1', '2']
                }
            }
        },
        data() {
            return {}
        }
    }

    const app = new Vue({
        el: '#app',
        data: {
            message: '卢本伟牛逼！',
            movies: ['lol', 'wow', 'csgo']
        },
        components: {
            cpn
        }
    })
</script>
</body>
</html>